Global Index
HTML5 JS API Index > DOM Tutorials & Specs

Document

Extends Node. Implements NonElementParentNode, ParentNode, GlobalEventHandlers.

Extended by XMLDocument, Document (Pointer Lock), Document (Fullscreen), Document (Selectors), Document (CSS Object Model), SVGDocument, SVGDocument

Document nodes are simply known as documents.

Properties
Element?activeElement
HTMLElement?
body
The body attribute, on getting, must return the body element of the document (either a body element, a frameset element, or null).
DOMString
characterSet
The characterSet attribute must return the name of the encoding.
unsigned long
childElementCount
The childElementCount attribute must return the number of children of the context object that are elements.
HTMLCollection
children
The children attribute must return an HTMLCollection collection rooted at the context object matching only element children.
HTMLCollection
commands
The commands attribute of the document's Document interface must return an HTMLCollection rooted at the Document node, whose filter matches only elements that define commands and have IDs.
DOMString
compatMode
The compatMode attribute must return "BackCompat" if the context object is in quirks mode, and "CSS1Compat" otherwise.
DOMString
contentType
The contentType attribute must return the content type.
DOMElementMap
cssElementMap
The cssElementMap IDL attribute allows authors to define CSS element reference identifiers, which are used in certain CSS features to override the normal ID-based mapping. [CSSIMAGES]
HTMLScriptElement?
currentScript
The currentScript attribute, on getting, must return the value to which it was most recently initialized. When the Document is created, the currentScript must be initialized to null.
WindowProxy?defaultView
DOMStringdesignMode
DOMString
dir
The dir IDL attribute on Document objects must reflect the dir content attribute of the html element, if any, limited to only known values. If there is no such element, then the attribute must return the empty string and do nothing on setting.
DocumentType?
doctype
The doctype attribute must return the child of the document that is a doctype, and null otherwise.
Element?
documentElement
The documentElement attribute must return the document element.
DOMString
documentURI
The URL and documentURI attributes must return the URL.
DOMStringdomain
HTMLCollection
embeds
The embeds attribute must return an HTMLCollection rooted at the Document node, whose filter matches only embed elements.
Element?
firstElementChild
The firstElementChild attribute must return the first child that is an element, and null otherwise.
HTMLCollection
forms
The forms attribute must return an HTMLCollection rooted at the Document node, whose filter matches only form elements.
Element (Fullscreen)?
fullscreenElement
The fullscreenElement attribute must return the top element of the context object's fullscreen element stack, or null otherwise.
boolean
fullscreenEnabled
The fullscreenEnabled attribute must return true if the context object and all ancestor browsing context's documents have their fullscreen enabled flag set, or false otherwise.
HTMLCollection
images
The images attribute must return an HTMLCollection rooted at the Document node, whose filter matches only img elements.
DOMImplementation
implementation
The implementation attribute must return the DOMImplementation object that is associated with the document.
Element?
lastElementChild
The lastElementChild attribute must return the last child that is an element, and null otherwise.
DOMStringlastModified
DOMString?
lastStyleSheetSet
The lastStyleSheetSet attribute must return the last CSS style sheet set name.
Location?location
EventHandleronabort
EventHandleronautocomplete
EventHandleronautocompleteerror
EventHandleronblur
EventHandleroncancel
EventHandleroncanplay
EventHandleroncanplaythrough
EventHandleronchange
EventHandleronclick
EventHandleronclose
EventHandleroncontextmenu
EventHandleroncuechange
EventHandlerondblclick
EventHandlerondrag
EventHandlerondragend
EventHandlerondragenter
EventHandlerondragexit
EventHandlerondragleave
EventHandlerondragover
EventHandlerondragstart
EventHandlerondrop
EventHandlerondurationchange
EventHandleronemptied
EventHandleronended
OnErrorEventHandleronerror
EventHandleronfocus
EventHandleroninput
EventHandleroninvalid
EventHandleronkeydown
EventHandleronkeypress
EventHandleronkeyup
EventHandleronload
EventHandleronloadeddata
EventHandleronloadedmetadata
EventHandleronloadstart
EventHandleronmousedown
EventHandleronmouseenter
EventHandleronmouseleave
EventHandleronmousemove
EventHandleronmouseout
EventHandleronmouseover
EventHandleronmouseup
EventHandleronmousewheel
EventHandleronpause
EventHandleronplay
EventHandleronplaying
EventHandler?
onpointerlockchange
An event handler for pointerlockchange events.
EventHandler?
onpointerlockerror
An event handler for pointerlockerror events.
EventHandleronprogress
EventHandleronratechange
EventHandleronreadystatechange
EventHandleronreset
EventHandleronresize
EventHandleronscroll
EventHandleronseeked
EventHandleronseeking
EventHandleronselect
EventHandleronshow
EventHandleronsort
EventHandleronstalled
EventHandleronsubmit
EventHandleronsuspend
EventHandlerontimeupdate
EventHandlerontoggle
EventHandleronvolumechange
EventHandleronwaiting
DOMString
origin
The origin attribute must return the Unicode serialization of context object's origin. [ORIGIN]
HTMLCollection
plugins
The plugins attribute must return the same object as that returned by the embeds attribute.
Element (Pointer Lock)?
pointerLockElement
Returns the element set as the target for mouse events while the pointer is locked. Null if lock is pending, pointer is unlocked, or if the target is in another document.
DOMString?
preferredStyleSheetSet
The preferredStyleSheetSet attribute must return the preferred CSS style sheet set name.
DocumentReadyState
readyState
The readyState IDL attribute must, on getting, return the current document readiness.
DOMString
referrer
The referrer attribute must return the document's referrer.
HTMLCollection
scripts
The scripts attribute must return an HTMLCollection rooted at the Document node, whose filter matches only script elements.
DOMString?selectedStyleSheetSet
StyleSheetList
styleSheets
The styleSheets attribute must return a StyleSheetList collection representing the document CSS style sheets.
DOMString[]
styleSheetSets
The styleSheetSets attribute must return a read only array of the CSS style sheet set names of the CSS style sheet sets, in order of the document CSS style sheets. The array is live; if the document CSS style sheets change, the array must be updated as appropriate.
DOMStringtitle
DOMString
URL
The URL and documentURI attributes must return the URL.
Constructor
Document()
Operations
NodeadoptNode(Node node)
voidappend((Node or DOMString) nodes...)
voidclose()
Comment
createComment(DOMString data)
The createComment(data) method must return a new Comment node with its data set to data and node document set to the context object.
DocumentFragment
createDocumentFragment()
The createDocumentFragment() method must return a new DocumentFragment node with its node document set to the context object.
ElementcreateElement(DOMString localName)
ElementcreateElementNS(DOMString? namespace, DOMString qualifiedName)
EventcreateEvent(DOMString interface)
NodeIteratorcreateNodeIterator(Node root, optional unsigned long whatToShow, optional NodeFilter? filter)
ProcessingInstructioncreateProcessingInstruction(DOMString target, DOMString data)
Range
createRange()
The createRange() method must return a new range with (context object, 0) as its start and end.
Text
createTextNode(DOMString data)
The createTextNode(data) method must return a new Text node with its data set to data and node document set to the context object.
TreeWalkercreateTreeWalker(Node root, optional unsigned long whatToShow, optional NodeFilter? filter)
voidenableStyleSheetsForSet(DOMString? name)
booleanexecCommand(DOMString commandId, optional boolean showUI, optional DOMString value)
voidexitFullscreen()
void
exitPointerLock()
Initiates an exit from pointer lock state if currently locked to a target in this document, and sends a pointerlockchange event when the lock state has been exited. The system mouse cursor must be displayed again and positioned at the same location that it was when pointer lock was entered (the same location that is reported in screenX/Y when the pointer is locked).
Element?
getElementById(DOMString elementId)
The getElementById(elementId) method must return the first element, in tree order, within context object's descendants, whose ID is elementId, and null if there is no such element otherwise.
HTMLCollection
getElementsByClassName(DOMString classNames)
The getElementsByClassName(classNames) method must return the list of elements with class names classNames for the context object.
NodeList
getElementsByName(DOMString elementName)
The getElementsByName(name) method takes a string name, and must return a live NodeList containing all the HTML elements in that document that have a name attribute whose value is equal to the name argument (in a case-sensitive manner), in tree order.
HTMLCollection
getElementsByTagName(DOMString localName)
The getElementsByTagName(localName) method must return the list of elements with local name localName for the context object.
HTMLCollection
getElementsByTagNameNS(DOMString? namespace, DOMString localName)
The getElementsByTagNameNS(namespace, localName) method must return the list of elements with namespace namespace and local name localName for the context object.
NodeListgetItems(optional DOMString typeNames)
objectgetter(DOMString name)
booleanhasFocus()
NodeimportNode(Node node, optional boolean deep)
Documentopen(optional DOMString type_url, optional DOMString replace_name, optional DOMString features, optional boolean replace)
voidprepend((Node or DOMString) nodes...)
Element?
query(DOMString relativeSelectors)
The query(relativeSelectors) method must return the first result of running match a relative selectors string relativeSelectors against a set consisting of context object, and null if the result is an empty list.
Elements
queryAll(DOMString relativeSelectors)
The queryAll(relativeSelectors) method must return an Elements array initialized with the result of running match a relative selectors string relativeSelectors against a set consisting of context object.
booleanqueryCommandEnabled(DOMString commandId)
booleanqueryCommandIndeterm(DOMString commandId)
booleanqueryCommandState(DOMString commandId)
booleanqueryCommandSupported(DOMString commandId)
DOMStringqueryCommandValue(DOMString commandId)
Element?
querySelector(DOMString selectors)
The querySelector() methods on the Document, DocumentFragment, and Element interfaces must return the first matching Element node within the subtrees of the context node. If there is no matching Element, the method must return null.
Element?
querySelector(DOMString selectors)
The querySelector(selectors) method must return the first result of running scope-match a selectors string selectors against the context object, and null if the result is an empty list otherwise.
NodeList
querySelectorAll(DOMString selectors)
The querySelectorAll() methods on the Document, DocumentFragment, and Element interfaces must return a NodeList containing all of the matching Element nodes within the subtrees of the context node, in document order. If there are no matching nodes, the method must return an empty NodeList.
NodeList
querySelectorAll(DOMString selectors)
The querySelectorAll(selectors) method must return the static result of running scope-match a selectors string selectors against the context object.
voidwrite(DOMString text...)
voidwriteln(DOMString text...)
Referenced by
DOMImplementationcreateHTMLDocument(...)
HTMLIFrameElementcontentDocument
HTMLObjectElementcontentDocument
NodeownerDocument
Windowdocument